Skip to content

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Aug 12, 2025

https://docs.astral.sh/ruff/rules/any-type --> https://results.pre-commit.ci/repo/github/778163871

Also, why not make this change?

  def is_empty(val: Any) -> bool:
-     return val in (None, "", 0, 0.0, {}) or (isinstance(val, dict) and not val)
+     return not val

https://docs.astral.sh/ruff/rules/any-type

Also, why not make this change?
```diff
  def is_empty(val: Any) -> bool:
-     return val in (None, "", 0, 0.0, {}) or (isinstance(val, dict) and not val)
+     return not val
```
@Copilot Copilot AI review requested due to automatic review settings August 12, 2025 11:44
@cclauss cclauss requested a review from amilcarlucas as a code owner August 12, 2025 11:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a pre-commit linting failure by adding a noqa: ANN401 comment to suppress ruff's warning about using Any type annotation. The change addresses a specific linting rule that flags the use of Any type hints as potentially problematic.

Key Changes

  • Added noqa: ANN401 comment to suppress ruff's any-type warning for the is_empty function parameter

@@ -368,7 +368,7 @@ def wipe_component_info(self) -> None:
},
}

def is_empty(val: Any) -> bool:
def is_empty(val: Any) -> bool: # noqa: ANN401
return val in (None, "", 0, 0.0, {}) or (isinstance(val, dict) and not val)
Copy link
Preview

Copilot AI Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider replacing the complex logic with return not val as suggested in the PR description. The current implementation val in (None, "", 0, 0.0, {}) or (isinstance(val, dict) and not val) is redundant since Python's truthiness evaluation already handles these cases correctly, and the dict check is unnecessary as empty dicts are falsy.

Suggested change
return val in (None, "", 0, 0.0, {}) or (isinstance(val, dict) and not val)
return not val

Copilot uses AI. Check for mistakes.

@amilcarlucas
Copy link
Collaborator

Thanks for looking into this. I've merged a better, simpler fix just now.

@cclauss cclauss deleted the patch-2 branch August 14, 2025 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants